package org.zhouhe.modules.imageSlider.action;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.zhouhe.base.BaseAction;
import org.zhouhe.modules.article.service.ArticleService;
import org.zhouhe.modules.imageSlider.service.ImageSliderService;
import org.zhouhe.modules.report.service.ReportService;
import org.zhouhe.page.PageUtil;
import org.zhouhe.vo.Article;
import org.zhouhe.vo.ImageSlider;
import org.zhouhe.vo.Report;

public class ImageSliderAction extends BaseAction {

	private static final long serialVersionUID = 3172977590976843309L;
	private PageUtil pageUtil = new PageUtil();
	private Report report = new Report();
	private Integer reportTypeId;
	private Article article = new Article();
	private Integer articleTypeId;
	private Integer industryId;
	private ImageSlider imageSlider = new ImageSlider();
	private List<ImageSlider> imageSliderList = new ArrayList<ImageSlider>();
	@Autowired
	private ImageSliderService imageSliderService;
	@Autowired
	private ReportService reportService;
	@Autowired
	private ArticleService articleService;

	public void save(){
		imageSliderService.save(imageSlider);
	}
	public void delete(){
		imageSliderService.delete(imageSlider);
	}
	public String list() {
		return "list";
	}

	public String imageSliders(){
		imageSliderList = imageSliderService.getImageSliderList(null);
		return "imageSliders";
	}
	
	public String articles() {
		article.setImgName("required");
		articleService.getArticleList(pageUtil, article, getIndustryId(), getArticleTypeId());
		return "articles";
	}

	public String reports() {
		report.setImgName("required");
		reportService.getReportList(pageUtil, report, getIndustryId(), getReportTypeId());
		return "reports";
	}
	public void updateOrder(){
		imageSliderService.updateOrder(imageSliderList);
	}

	public void setPageUtil(PageUtil pageUtil) {
		this.pageUtil = pageUtil;
	}

	public PageUtil getPageUtil() {
		return pageUtil;
	}

	public void setArticle(Article article) {
		this.article = article;
	}

	public Article getArticle() {
		return article;
	}

	public void setReport(Report report) {
		this.report = report;
	}

	public Report getReport() {
		return report;
	}

	public void setReportTypeId(Integer reportTypeId) {
		this.reportTypeId = reportTypeId;
	}

	public Integer getReportTypeId() {
		return reportTypeId;
	}

	public void setArticleTypeId(Integer articleTypeId) {
		this.articleTypeId = articleTypeId;
	}

	public Integer getArticleTypeId() {
		return articleTypeId;
	}

	public void setIndustryId(Integer industryId) {
		this.industryId = industryId;
	}

	public Integer getIndustryId() {
		return industryId;
	}

	public void setImageSliderList(List<ImageSlider> imageSliderList) {
		this.imageSliderList = imageSliderList;
	}

	public List<ImageSlider> getImageSliderList() {
		return imageSliderList;
	}
	public void setImageSlider(ImageSlider imageSlider) {
		this.imageSlider = imageSlider;
	}
	public ImageSlider getImageSlider() {
		return imageSlider;
	}

}
